Migrated Logging functional tests to Vitest+Playwright+MSW#1535
Migrated Logging functional tests to Vitest+Playwright+MSW#1535carterworks wants to merge 12 commits into
Conversation
|
| Filename | Overview |
|---|---|
| packages/browser/test/integration/specs/Logging/logging.spec.js | New integration spec migrating 4 functional tests (C2583, C2584, C2586, C532204) to Vitest+MSW. C2586 uses raw vitestTest to set the URL before alloy loads; alloyConfig includes debugEnabled: false in C2586, testing URL-param-wins-over-config rather than the URL-only scenario in the original test. |
Sequence Diagram
sequenceDiagram
participant BH as beforeEach
participant FX as alloy fixture (auto)
participant T as Test body
participant AH as afterEach
Note over BH,AH: C2583 / C2584 flow
BH->>BH: "consoleSpy = vi.spyOn(console, info)"
FX->>FX: cookie cleanup
FX->>FX: setupBaseCode()
FX->>FX: setupAlloy()
T->>T: alloy configure / sendEvent / getLibraryInfo
T->>T: expect(searchForLogMessage(consoleSpy, ...))
FX->>FX: cleanAlloy()
AH->>AH: consoleSpy.mockRestore()
Note over BH,AH: C2586 flow (vitestTest - no extended fixture)
T->>T: "consoleSpy = vi.spyOn(console, info)"
T->>T: "withTemporaryUrl - applyUrl alloy_debug=true"
T->>T: setupBaseCode()
T->>T: setupAlloy()
T->>T: alloy configure / getLibraryInfo
T->>T: expect(searchForLogMessage(consoleSpy, ...))
T->>T: cleanAlloy()
T->>T: finally consoleSpy.mockRestore()
Reviews (2): Last reviewed commit: "test(integration): migrate logging funct..." | Re-trigger Greptile
31ef5eb to
5914312
Compare
19ba2a4 to
f847fde
Compare
|
5914312 to
f38d93a
Compare
f847fde to
c698d64
Compare
There was a problem hiding this comment.
carterworks has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.
There was a problem hiding this comment.
carterworks has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.
6242b77 to
f15d638
Compare
f15d638 to
f352c78
Compare
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The C532204 test re-spied console.info, which the file's beforeEach had already spied. vi.spyOn returns the existing spy, so binding `through` to console.info bound it to that same spy and forwarding looped back through the mock implementation (stack overflow). Forward to console methods captured before beforeEach installs the spy instead. Also snapshot the call count inside the try block: mockRestore in the finally clears mock.calls, so reading it afterward always saw 0.
The console spies forwarded to the real console by default, so alloy's debug logging spammed the test reporter. Stub them with a no-op implementation: searchForLogMessage reads spy.mock.calls, not actual output, so assertions are unaffected. This also drops the originalConsole forwarding in C532204 (and with it the recursion risk it guarded against).
3471d09 to
1a47ae5
Compare
Keep the original testcafe functional specs alongside the new Vitest+Playwright+MSW integration suite until these migration branches merge, so reviewers retain the pre-migration signal.
Changed Packages
Description
Migrates the Logging functional tests to the new Vitest+Playwright+MSW harness.
Related Issue
Part of the functional test → integration test migration. See
packages/browser/test/FUNCTIONAL_MIGRATION_PLAN.md.Motivation and Context
The existing TestCafe functional test suite is being migrated to Vitest+Playwright+MSW to enable faster, more reliable CI testing without a running server. This PR is part of a stacked series — each PR migrates one test file.
Functional tests replaced:
packages/browser/test/functional/specs/Logging/C2583.jspackages/browser/test/functional/specs/Logging/C2584.jspackages/browser/test/functional/specs/Logging/C2586.jspackages/browser/test/functional/specs/Logging/C532204.jsTypes of changes
Checklist:
Stack